package com.tengju.user.infrastructure.repository.archive;

import com.tengju.user.domain.model.archive.letax.LetaxWhiteRepository;
import com.tengju.user.domain.model.user.UserIdCode;
import com.tengju.user.domain.shared.AccountId;
import com.tengju.user.infrastructure.persistence.mybatis.mapper.dealer.generate.LetaxAccountDOMapper;
import com.tengju.user.infrastructure.persistence.mybatis.mapper.dealer.generate.LetaxAccountWhiteDOMapper;
import org.springframework.stereotype.Repository;

@Repository
public class LetaxWhiteRepositoryImpl implements LetaxWhiteRepository {

    private final LetaxAccountWhiteDOMapper letaxAccountWhiteDOMapper;

    public LetaxWhiteRepositoryImpl(LetaxAccountDOMapper letaxAccountDOMapper,
            LetaxAccountWhiteDOMapper letaxAccountWhiteDOMapper) {
        this.letaxAccountWhiteDOMapper = letaxAccountWhiteDOMapper;
    }

    @Override
    public int countWhite(UserIdCode idCode, AccountId accountId) {
        return letaxAccountWhiteDOMapper.countWhite(idCode.getValue(), accountId.getValue(), 1);
    }
}
